package cn.tedu.boot01.controller;

import cn.tedu.boot01.entity.Emp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class ParamController {

    @RequestMapping("/p1")
    public String p1(HttpServletRequest request) {
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        return "测试成功，<b>测试成功</b>" + name + "  " + age;
    }

    @RequestMapping("/p2")
    public String p2(String name, int age) {
        return "测试成功！name=" + name + "age=" + age;
    }

    @RequestMapping("/p3")
    public String p3(Emp emp) {
        System.out.println("emp = " + emp);
        return emp.toString();
    }
}
